﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;

namespace FunctionPoint.Converters
{
    public class NestLevelToMarginConverter : IValueConverter
    {

        const int oneLevelMargin = 10;

        private int _indentLevel = 10;
        private int _rightMargin = 1;
        private int _topMargin = 1;
        private int _bottomMargin = 1;

        public int IndentLevel
        {
            get { return _indentLevel; }
            set { _indentLevel = value; }
        }

        public int RightMargin
        {
            get { return _rightMargin; }
            set { _rightMargin = value; }
        }

        public int BottomMargin
        {
            get { return _bottomMargin; }
            set { _bottomMargin = value; }
        }
        public int TopMargin
        {
            get { return _topMargin; }
            set { _topMargin = value; }
        }

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            int nestLevel = (int)value;
            return new Thickness(IndentLevel * nestLevel, TopMargin, RightMargin, BottomMargin);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
        }
    }
}
